import Taro, { Component } from '@tarojs/taro'
import { View, Text } from '@tarojs/components'
import './systemnewslist.css'
import { $navigateBack, $navigateTo, } from '../../../global';
import { AtList, AtListItem, AtBadge } from "taro-ui"
import reactMixin from 'react-mixin';
import myJs from './systemnewslistJs.js'
import app from '../../../main.js'

export default class SystemNewsList extends Component {

  config = {
    navigationBarTitleText: '系统消息列表'
  }
  constructor() {
    super(...arguments);
    this.state = this.getData();
  }
  init() { }

  go(url) {
    $navigateTo(url);
  }

  render() {

    return (
      <View className='system-news-list'>
        <AtList>
          {this.state.messages.items.map((item) => {
            return (<View>
              {item.is_read == '否' ? (
                <View className='hongdian'>
                  <AtBadge className='dot' dot></AtBadge>
                  <AtListItem onClick={this.go.bind(this, '../systemnews/systemnews')} extraText={item.created_at} title={item.title} arrow='right' />
                </View>
              ) : (
                  <AtListItem onClick={this.go.bind(this, '../systemnews/systemnews')} extraText={item.created_at} title={item.title} arrow='right' />
                )}
            </View>);
          })
          }
        </AtList>
      </View>
    )
  }
}
reactMixin.onClass(SystemNewsList, myJs);
